function GAD_Etom_saline_altcontext_crossday_pv_cdf(Data_Summary)
%% WT saline data
G18_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F4_18') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G18_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G18_saline_PV = PV;
        G18_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F4_18') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G18_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G18_saline_PV = cat(1,G18_saline_PV,PV);
        G18_saline_Shuffle = cat(1,G18_saline_Shuffle,PV_Shuffle);
    end
end
[G18sf,G18sx,G18slow,G18shigh] = ecdf(G18_saline_PV,'Function','cdf','Alpha',0.05);
[G18ssf,G18ssx,G18sslow,G18sshigh] = ecdf(G18_saline_Shuffle,'Function','cdf','Alpha',0.05);

G28_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_28') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G28_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G28_saline_PV = PV;
        G28_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_28') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G28_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G28_saline_PV = cat(1,G28_saline_PV,PV);
        G28_saline_Shuffle = cat(1,G28_saline_Shuffle,PV_Shuffle);
    end
end
[G28sf,G28sx,G28slow,G28shigh] = ecdf(G28_saline_PV,'Function','cdf','Alpha',0.05);
[G28ssf,G28ssx,G28sslow,G28sshigh] = ecdf(G28_saline_Shuffle,'Function','cdf','Alpha',0.05);

G31_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_31') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G31_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G31_saline_PV = PV;
        G31_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_31') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G31_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G31_saline_PV = cat(1,G31_saline_PV,PV);
        G31_saline_Shuffle = cat(1,G31_saline_Shuffle,PV_Shuffle);
    end
end
[G31sf,G31sx,G31slow,G31shigh] = ecdf(G31_saline_PV,'Function','cdf','Alpha',0.05);
[G31ssf,G31ssx,G31sslow,G31sshigh] = ecdf(G31_saline_Shuffle,'Function','cdf','Alpha',0.05);

G34_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_34') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G34_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G34_saline_PV = PV;
        G34_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_34') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G34_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G34_saline_PV = cat(1,G34_saline_PV,PV);
        G34_saline_Shuffle = cat(1,G34_saline_Shuffle,PV_Shuffle);
    end
end
[G34sf,G34sx,G34slow,G34shigh] = ecdf(G34_saline_PV,'Function','cdf','Alpha',0.05);
[G34ssf,G34ssx,G34sslow,G34sshigh] = ecdf(G34_saline_Shuffle,'Function','cdf','Alpha',0.05);

%% Organize data for WT saline

% get WT saline CDF mean
A = cat(1,G18sf,G28sf,G31sf,G34sf);
WT_saline_F = sort(A);
WT_saline_F = cat(1, 0, WT_saline_F, 1);

% get WT saline CDF x-steps
B = cat(1,G18sx,G28sx,G31sx,G34sx);
WT_saline_X = sort(B);
WT_saline_X = cat(1, -1, WT_saline_X, 1);

% get WT saline CDF high bound mean
C = cat(1,G18shigh,G28shigh,G31shigh,G34shigh);
WT_saline_H = sort(C);

% get WT saline CDF low bound mean
D = cat(1,G18slow,G28slow,G31slow,G34slow);
WT_saline_L = sort(D);

%% MUT saline data
G17_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F4_17') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G17_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G17_saline_PV = PV;
        G17_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F4_17') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G17_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G17_saline_PV = cat(1,G17_saline_PV,PV);
        G17_saline_Shuffle = cat(1,G17_saline_Shuffle,PV_Shuffle);
    end
end
[G17sf,G17sx,G17slow,G17shigh] = ecdf(G17_saline_PV,'Function','cdf','Alpha',0.05);
[G17ssf,G17ssx,G17sslow,G17sshigh] = ecdf(G17_saline_Shuffle,'Function','cdf','Alpha',0.05);

G21_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_21') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G21_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G21_saline_PV = PV;
        G21_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_21') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G21_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G21_saline_PV = cat(1,G21_saline_PV,PV);
        G21_saline_Shuffle = cat(1,G21_saline_Shuffle,PV_Shuffle);
    end
end
[G21sf,G21sx,G21slow,G21shigh] = ecdf(G21_saline_PV,'Function','cdf','Alpha',0.05);
[G21ssf,G21ssx,G21sslow,G21sshigh] = ecdf(G21_saline_Shuffle,'Function','cdf','Alpha',0.05);

G45_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_45') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G45_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G45_saline_PV = PV;
        G45_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_45') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G45_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G45_saline_PV = cat(1,G45_saline_PV,PV);
        G45_saline_Shuffle = cat(1,G45_saline_Shuffle,PV_Shuffle);
    end
end
[G45sf,G45sx,G45slow,G45shigh] = ecdf(G45_saline_PV,'Function','cdf','Alpha',0.05);
[G45ssf,G45ssx,G45sslow,G45sshigh] = ecdf(G45_saline_Shuffle,'Function','cdf','Alpha',0.05);

G53_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_53') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G53_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G53_saline_PV = PV;
        G53_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_53') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G53_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G53_saline_PV = cat(1,G53_saline_PV,PV);
        G53_saline_Shuffle = cat(1,G53_saline_Shuffle,PV_Shuffle);
    end
end
[G53sf,G53sx,G53slow,G53shigh] = ecdf(G53_saline_PV,'Function','cdf','Alpha',0.05);
[G53ssf,G53ssx,G53sslow,G53sshigh] = ecdf(G53_saline_Shuffle,'Function','cdf','Alpha',0.05);


%% Organize data for MUT saline

% get MUT saline CDF mean
A = cat(1,G17sf,G21sf,G45sf,G53sf);
MUT_saline_F = sort(A);
MUT_saline_F = cat(1, 0, MUT_saline_F, 1);

% get MUT saline CDF x-steps
B = cat(1,G17sx,G21sx,G45sx,G53sx);
MUT_saline_X = sort(B);
MUT_saline_X = cat(1, -1, MUT_saline_X, 1);

% get MUT saline CDF high bound mean
C = cat(1,G17shigh,G21shigh,G45shigh,G53shigh);
MUT_saline_H = sort(C);

% get MUT saline CDF low bound mean
D = cat(1,G17slow,G21slow,G45slow,G53slow);
MUT_saline_L = sort(D);


%% WT 4h altered contexts data
G28_AB_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_28') && strcmp(Data_Summary(n).drug,'AB')  && isempty(G28_AB_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G28_AB_PV = PV;
        G28_AB_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_28') && strcmp(Data_Summary(n).drug,'AB')   && ~isempty(G28_AB_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G28_AB_PV = cat(1,G28_AB_PV,PV);
        G28_AB_Shuffle = cat(1,G28_AB_Shuffle,PV_Shuffle);
    end
end
[G28abf,G28abx,G28ablow,G28abhigh] = ecdf(G28_AB_PV,'Function','cdf','Alpha',0.05);
[G28sabf,G28sabx,G28sablow,G28sabhigh] = ecdf(G28_AB_Shuffle,'Function','cdf','Alpha',0.05);

G31_AB_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_31') && strcmp(Data_Summary(n).drug,'AB')  && isempty(G31_AB_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G31_AB_PV = PV;
        G31_AB_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_31') && strcmp(Data_Summary(n).drug,'AB')   && ~isempty(G31_AB_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G31_AB_PV = cat(1,G31_AB_PV,PV);
        G31_AB_Shuffle = cat(1,G31_AB_Shuffle,PV_Shuffle);
    end
end
[G31abf,G31abx,G31ablow,G31abhigh] = ecdf(G31_AB_PV,'Function','cdf','Alpha',0.05);
[G31sabf,G31sabx,G31sablow,G31sabhigh] = ecdf(G31_AB_Shuffle,'Function','cdf','Alpha',0.05);

G34_AB_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_34') && strcmp(Data_Summary(n).drug,'AB')  && isempty(G34_AB_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G34_AB_PV = PV;
        G34_AB_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_34') && strcmp(Data_Summary(n).drug,'AB')   && ~isempty(G34_AB_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G34_AB_PV = cat(1,G34_AB_PV,PV);
        G34_AB_Shuffle = cat(1,G34_AB_Shuffle,PV_Shuffle);
    end
end
[G34abf,G34abx,G34ablow,G34abhigh] = ecdf(G34_AB_PV,'Function','cdf','Alpha',0.05);
[G34sabf,G34sabx,G34sablow,G34sabhigh] = ecdf(G34_AB_Shuffle,'Function','cdf','Alpha',0.05);

%% Organize data for WT 4h altered contexts

% get WT saline CDF mean
A = cat(1,G28abf,G31abf,G34abf);
WT_AB_F = sort(A);
WT_AB_F = cat(1, 0, WT_AB_F, 1);

% get WT saline CDF x-steps
B = cat(1,G28abx,G31abx,G34abx);
WT_AB_X = sort(B);
WT_AB_X = cat(1, -1, WT_AB_X, 1);

% get WT saline CDF high bound mean
C = cat(1,G28abhigh,G31abhigh,G34abhigh);
WT_AB_H = sort(C);

% get WT saline CDF low bound mean
D = cat(1,G28ablow,G31ablow,G34ablow);
WT_AB_L = sort(D);

%% MUT 4h altered contexts data
G21_AB_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_21') && strcmp(Data_Summary(n).drug,'AB')  && isempty(G21_AB_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G21_AB_PV = PV;
        G21_AB_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_21') && strcmp(Data_Summary(n).drug,'AB')   && ~isempty(G21_AB_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G21_AB_PV = cat(1,G21_AB_PV,PV);
        G21_AB_Shuffle = cat(1,G21_AB_Shuffle,PV_Shuffle);
    end
end
[G21abf,G21abx,G21ablow,G21abhigh] = ecdf(G21_AB_PV,'Function','cdf','Alpha',0.05);
[G21sabf,G21sabx,G21sablow,G21sabhigh] = ecdf(G21_AB_Shuffle,'Function','cdf','Alpha',0.05);

G45_AB_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_45') && strcmp(Data_Summary(n).drug,'AB')  && isempty(G45_AB_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G45_AB_PV = PV;
        G45_AB_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_45') && strcmp(Data_Summary(n).drug,'AB')   && ~isempty(G45_AB_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G45_AB_PV = cat(1,G45_AB_PV,PV);
        G45_AB_Shuffle = cat(1,G45_AB_Shuffle,PV_Shuffle);
    end
end
[G45abf,G45abx,G45ablow,G45abhigh] = ecdf(G45_AB_PV,'Function','cdf','Alpha',0.05);
[G45sabf,G45sabx,G45sablow,G45sabhigh] = ecdf(G45_AB_Shuffle,'Function','cdf','Alpha',0.05);

G53_AB_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_53') && strcmp(Data_Summary(n).drug,'AB')  && isempty(G53_AB_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G53_AB_PV = PV;
        G53_AB_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_53') && strcmp(Data_Summary(n).drug,'AB')   && ~isempty(G53_AB_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G53_AB_PV = cat(1,G53_AB_PV,PV);
        G53_AB_Shuffle = cat(1,G53_AB_Shuffle,PV_Shuffle);
    end
end
[G53abf,G53abx,G53ablow,G53abhigh] = ecdf(G53_AB_PV,'Function','cdf','Alpha',0.05);
[G53sabf,G53sabx,G53sablow,G53sabhigh] = ecdf(G53_AB_Shuffle,'Function','cdf','Alpha',0.05);


%% Organize data for MUT 4h altered contexts

% get MUT saline CDF mean
A = cat(1,G21abf,G45abf,G53abf);
MUT_AB_F = sort(A);
MUT_AB_F = cat(1, 0, MUT_AB_F, 1);

% get MUT saline CDF x-steps
B = cat(1,G21abx,G45abx,G53abx);
MUT_AB_X = sort(B);
MUT_AB_X = cat(1, -1, MUT_AB_X, 1);

% get MUT saline CDF high bound mean
C = cat(1,G21abhigh,G45abhigh,G53abhigh);
MUT_AB_H = sort(C);

% get MUT saline CDF low bound mean
D = cat(1,G21ablow,G45ablow,G53ablow);
MUT_AB_L = sort(D);


% % %% get WT cross-day data
% % 
% % G18XDay = XDay_PV_Summary.G2_F4_18;
% % G18_XDay_PV = [];
% % for n = 1:size(G18XDay,2)
% %     if isempty(G18_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G18XDay(n).PV_Corr_Values, G18XDay(n).PV_Corr_Values, G18XDay(n).Coherent_Rot);
% %         G18_XDay_PV = PV;
% %     elseif ~isempty(G18_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G18XDay(n).PV_Corr_Values, G18XDay(n).PV_Corr_Values, G18XDay(n).Coherent_Rot);
% %         G18_XDay_PV = cat(1,G18_XDay_PV,PV);
% %     end
% % end
% % [G18xf,G18xx,G18xlow,G18xhigh] = ecdf(G18_XDay_PV,'Function','cdf','Alpha',0.05);
% % 
% % 
% % G28XDay = XDay_PV_Summary.G2_F52_28;
% % G28_XDay_PV = [];
% % for n = 1:size(G28XDay,2)
% %     if isempty(G28_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G28XDay(n).PV_Corr_Values, G28XDay(n).PV_Corr_Values, G28XDay(n).Coherent_Rot);
% %         G28_XDay_PV = PV;
% %     elseif ~isempty(G28_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G28XDay(n).PV_Corr_Values, G28XDay(n).PV_Corr_Values, G28XDay(n).Coherent_Rot);
% %         G28_XDay_PV = cat(1,G28_XDay_PV,PV);
% %     end
% % end
% % [G28xf,G28xx,G28xlow,G28xhigh] = ecdf(G28_XDay_PV,'Function','cdf','Alpha',0.05);
% % 
% % 
% % G31XDay = XDay_PV_Summary.G2_F52_31;
% % G31_XDay_PV = [];
% % for n = 1:size(G31XDay,2)
% %     if isempty(G31_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G31XDay(n).PV_Corr_Values, G31XDay(n).PV_Corr_Values, G31XDay(n).Coherent_Rot);
% %         G31_XDay_PV = PV;
% %     elseif ~isempty(G31_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G31XDay(n).PV_Corr_Values, G31XDay(n).PV_Corr_Values, G31XDay(n).Coherent_Rot);
% %         G31_XDay_PV = cat(1,G31_XDay_PV,PV);
% %     end
% % end
% % [G31xf,G31xx,G31xlow,G31xhigh] = ecdf(G31_XDay_PV,'Function','cdf','Alpha',0.05);
% % 
% % 
% % G34XDay = XDay_PV_Summary.G2_F52_34;
% % G34_XDay_PV = [];
% % for n = 1:size(G34XDay,2)
% %     if isempty(G34_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G34XDay(n).PV_Corr_Values, G34XDay(n).PV_Corr_Values, G34XDay(n).Coherent_Rot);
% %         G34_XDay_PV = PV;
% %     elseif ~isempty(G34_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G34XDay(n).PV_Corr_Values, G34XDay(n).PV_Corr_Values, G34XDay(n).Coherent_Rot);
% %         G34_XDay_PV = cat(1,G34_XDay_PV,PV);
% %     end
% % end
% % [G34xf,G34xx,G34xlow,G34xhigh] = ecdf(G34_XDay_PV,'Function','cdf','Alpha',0.05);
% % 
% % 
% % %% Organize data for WT Xday
% % 
% % % get WT xday CDF mean
% % A = cat(1,G18xf,G28xf,G31xf,G34xf);
% % WT_X_F = sort(A);
% % WT_X_F = cat(1, 0, WT_X_F, 1);
% % 
% % % get WT xday CDF x-steps
% % B = cat(1,G18xx,G28xx,G31xx,G34xx);
% % WT_X_X = sort(B);
% % WT_X_X = cat(1, -1, WT_X_X, 1);
% % 
% % % get WT xday CDF high bound mean
% % C = cat(1,G18xhigh,G28xhigh,G31xhigh,G34xhigh);
% % WT_X_H = sort(C);
% % 
% % % get WT xday CDF low bound mean
% % D = cat(1,G18xlow,G28xlow,G31xlow,G34xlow);
% % WT_X_L = sort(D);
% % 
% % 
% % %% get MUT cross-day data
% % 
% % G17XDay = XDay_PV_Summary.G2_F4_17;
% % G17_XDay_PV = [];
% % for n = 1:size(G17XDay,2)
% %     if isempty(G17_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G17XDay(n).PV_Corr_Values, G17XDay(n).PV_Corr_Values, G17XDay(n).Coherent_Rot);
% %         G17_XDay_PV = PV;
% %     elseif ~isempty(G17_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G17XDay(n).PV_Corr_Values, G17XDay(n).PV_Corr_Values, G17XDay(n).Coherent_Rot);
% %         G17_XDay_PV = cat(1,G17_XDay_PV,PV);
% %     end
% % end
% % [G17xf,G17xx,G17xlow,G17xhigh] = ecdf(G17_XDay_PV,'Function','cdf','Alpha',0.05);
% % 
% % 
% % G21XDay = XDay_PV_Summary.G2_F52_21;
% % G21_XDay_PV = [];
% % for n = 1:size(G21XDay,2)
% %     if isempty(G21_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G21XDay(n).PV_Corr_Values, G21XDay(n).PV_Corr_Values, G21XDay(n).Coherent_Rot);
% %         G21_XDay_PV = PV;
% %     elseif ~isempty(G21_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G21XDay(n).PV_Corr_Values, G21XDay(n).PV_Corr_Values, G21XDay(n).Coherent_Rot);
% %         G21_XDay_PV = cat(1,G21_XDay_PV,PV);
% %     end
% % end
% % [G21xf,G21xx,G21xlow,G21xhigh] = ecdf(G21_XDay_PV,'Function','cdf','Alpha',0.05);
% % 
% % 
% % G45XDay = XDay_PV_Summary.G2_F52_45;
% % G45_XDay_PV = [];
% % for n = 1:size(G45XDay,2)
% %     if isempty(G45_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G45XDay(n).PV_Corr_Values, G45XDay(n).PV_Corr_Values, G45XDay(n).Coherent_Rot);
% %         G45_XDay_PV = PV;
% %     elseif ~isempty(G45_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G45XDay(n).PV_Corr_Values, G45XDay(n).PV_Corr_Values, G45XDay(n).Coherent_Rot);
% %         G45_XDay_PV = cat(1,G45_XDay_PV,PV);
% %     end
% % end
% % [G45xf,G45xx,G45xlow,G45xhigh] = ecdf(G45_XDay_PV,'Function','cdf','Alpha',0.05);
% % 
% % 
% % G53XDay = XDay_PV_Summary.G2_F52_53;
% % G53_XDay_PV = [];
% % for n = 1:size(G53XDay,2)
% %     if isempty(G53_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G53XDay(n).PV_Corr_Values, G53XDay(n).PV_Corr_Values, G53XDay(n).Coherent_Rot);
% %         G53_XDay_PV = PV;
% %     elseif ~isempty(G53_XDay_PV)
% %         [PV, ~] = get_PV_values_ready(G53XDay(n).PV_Corr_Values, G53XDay(n).PV_Corr_Values, G53XDay(n).Coherent_Rot);
% %         G53_XDay_PV = cat(1,G53_XDay_PV,PV);
% %     end
% % end
% % [G53xf,G53xx,G53xlow,G53xhigh] = ecdf(G53_XDay_PV,'Function','cdf','Alpha',0.05);
% % 
% % 
% % %% Organize data for MUT Xday
% % 
% % % get MUT xday CDF mean
% % A = cat(1,G17xf,G21xf,G45xf,G53xf);
% % MUT_X_F = sort(A);
% % MUT_X_F = cat(1, 0, MUT_X_F, 1);
% % 
% % % get MUT xday CDF x-steps
% % B = cat(1,G17xx,G21xx,G45xx,G53xx);
% % MUT_X_X = sort(B);
% % MUT_X_X = cat(1, -1, MUT_X_X, 1);
% % 
% % % get MUT xday CDF high bound mean
% % C = cat(1,G17xhigh,G21xhigh,G45xhigh,G53xhigh);
% % MUT_X_H = sort(C);
% % 
% % % get MUT xday CDF low bound mean
% % D = cat(1,G17xlow,G21xlow,G45xlow,G53xlow);
% % MUT_X_L = sort(D);

%% Finally, put shuffle data together

% get shuffle CDF mean
A = cat(1,G17ssf,G21ssf,G45ssf,G53ssf,G18ssf,G28ssf,G31ssf,G34ssf);
Shuffle_F = sort(A);
Shuffle_F = cat(1, 0, Shuffle_F, 1);

% get shuffle CDF x-steps
B = cat(1,G17ssx,G21ssx,G45ssx,G53ssx,G18ssx,G28ssx,G31ssx,G34ssx);
Shuffle_X = sort(B);
Shuffle_X = cat(1, -1, Shuffle_X, 1);

% get shuffle CDF high bound mean
C = cat(1,G17sshigh,G21sshigh,G45sshigh,G53sshigh,G18sshigh,G28sshigh,G31sshigh,G34sshigh);
Shuffle_H = sort(C);

% get shuffle CDF low bound mean
D = cat(1,G17sslow,G21sslow,G45sslow,G53sslow,G18sslow,G28sslow,G31sslow,G34sslow);
Shuffle_L = sort(D);


%% plot all data

figure
subplot(1,2,1)
plot(WT_saline_X,WT_saline_F,'Color','#1750AC' ,'LineWidth',3);
hold on
% plot(WT_saline_X,WT_saline_L,'--k','LineWidth',1);
% hold on
% plot(WT_saline_X,WT_saline_H,'--k','LineWidth',1);
% hold on
plot(WT_AB_X,WT_AB_F,'Color','#4DED30','LineWidth',3);
hold on
% plot(WT_AB_X,WT_AB_L,'--k','LineWidth',1);
% hold on
% plot(WT_AB_X,WT_AB_H,'--k','LineWidth',1);
% hold on
% % plot(WT_X_X,WT_X_F,'Color','#4DED30' ,'LineWidth',3);
% % hold on
% % plot(WT_X_X,WT_X_L,'--k','LineWidth',1);
% % hold on
% % plot(WT_X_X,WT_X_H,'--k','LineWidth',1);
% % hold on
plot(Shuffle_X,Shuffle_F,'-k','LineWidth',3);
hold on
% plot(Shuffle_X,Shuffle_L,'--k','LineWidth',1);
% hold on
% plot(Shuffle_X,Shuffle_H,'--k','LineWidth',1);
% hold on
xlabel('PV Correlation Value')
ylabel('Cumulative Fraction of Cells')
xlim([-0.6,1])
set(gca,'FontSize',20)
% set(gca, 'visible', 'off')
hold off

subplot(1,2,2)
plot(MUT_saline_X,MUT_saline_F,'Color','#F53BD6','LineWidth',3);
hold on
% plot(MUT_saline_X,MUT_saline_L,'--k','LineWidth',1);
% hold on
% plot(MUT_saline_X,MUT_saline_H,'--k','LineWidth',1);
% hold on
plot(MUT_AB_X,MUT_AB_F,'Color','#FC6A03' ,'LineWidth',3);
hold on
% plot(MUT_AB_X,MUT_AB_L,'--k','LineWidth',1);
% hold on
% plot(MUT_AB_X,MUT_AB_H,'--k','LineWidth',1);
% hold on
% % plot(MUT_X_X,MUT_X_F,'Color','#4DED30' ,'LineWidth',3);
% % hold on
% % plot(MUT_X_X,MUT_X_L,'--k','LineWidth',1);
% % hold on
% % plot(MUT_X_X,MUT_X_H,'--k','LineWidth',1);
% % hold on
plot(Shuffle_X,Shuffle_F,'-k','LineWidth',3);
hold on
% plot(Shuffle_X,Shuffle_L,'--k','LineWidth',1);
% hold on
% plot(Shuffle_X,Shuffle_H,'--k','LineWidth',1);
% hold on
xlabel('PV Correlation Value')
ylabel('Cumulative Fraction of Cells')
xlim([-0.6,1])
set(gca,'FontSize',20)
% set(gca, 'visible', 'off')
hold off

end